Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method for acquiring a histogram, a method for dynamically adjusting luminance and an image processing apparatus.
Related Art
As shown in FIG. 1, the existing histogram drawing method is as follows:
1. Collect data: M statistics X values are collected.
2. Determine a data range (R): the maximum value and the minimum value defined of are respectively set as X(max) and X(min); if the minimum unit amount of X is ΔX=2a>0, R=X(max)−X(min)+ΔX.
3. Determine a class interval (h): a class number of a histogram is determined at first, then the range is divided by the class number, and the width of each class of the histogram can be obtained, that is, the class interval. In this example, the class number is set as N, the class interval h=R/N. The class number should be determined properly, wherein if the class number is too small, it will lead to a greater calculation error; if the class number too much, it will affect prominence of a data grouping rule and increase the cost of and may increase the work load of calculation and affect a response speed.
4. Determine a boundary value of each class: to be able to make statistics on all the X values, a lower limiting value of the first class and an upper limiting value of the Nth class comparatively spatial, respectively being X(min)−a and X(max)+a. An upper limiting value of the first class is the lower limiting value of the first class plus the range, is, X(min)−a+h; and a lower limiting value of the second class is the upper limiting value of the first class, an upper limiting value of the second class is the lower limiting value of the second class plus the range, that is, X(min)−a+2h, and boundaries of respective classes are deduced by such analogy.
5. Draw out a frequency distribution table: statistics is made on the M X values, which are listed into corresponding classes according to sizes, and finally frequencies of each class of X values are calculated, the frequencies are set as Pi, wherein i=1, 2 . . . N, and the following equation needs to be satisfied:
                    ∑                  i          =          1                N            ⁢                          ⁢              P        i              =    M    ,
As shown by the following Table 1, the existing histogram statistic:
TABLE 1StatisticalFrequencybar numberStatistical rule (condition)distribution1X (min) − a < X < X (min) − a + hP12X (min) − a + h < X < X (min) − a + 2hP2. . .. . .. . .NX (min) − a + (N − 1)h < X < X (max) + aPN
6. Generate a histogram: a horizontal ordinate X and a vertical ordinate Pi are drawn respectively according to a scale of data value, and the height of each statistical bar is drawn according to the vertical ordinate.
The histogram drawn according to the aforementioned method has defects, that is, when applied to data statistics in the field of image processing, the histogram cannot reflect features of image quality more accurately and more comprehensively if a user has higher requirements for precision of image quality processing.
The above contents are merely used for assisting in understanding the technical solution of the present invention, which does not mean admitting that the above contents are prior arts.